import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home.vue'
// -------------------------------------------------------------
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Table from '../views/Table.vue'
import Cash from '../views/Cash.vue'
import Food from '../views/Food.vue'
import Order from '../views/Order.vue'
import Stuff from '../views/Stuff.vue'
import Vip from '../views/Vip.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/register',
    name: 'register',
    component: Register,
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: Home
    },
    children: [
      {
        path: 'cash',
        name: 'cash',
        component: Cash,
        meta: { title: ['收银管理'] }
      },
      {
        path: 'food',
        name: 'food',
        component: Food,
        meta: { title: ['菜品管理'] }
      },
      {
        path: 'order',
        name: 'order',
        component: Order,
        meta: { title: ['点菜管理'] }
      },
      {
        path: 'stuff',
        name: 'stuff',
        component: Stuff,
        meta: { title: ['员工管理'] }
      },
      {
        path: 'table',
        name: 'table',
        component: Table,
        meta: { title: ['餐桌管理'] }
      },
      {
        path: 'vip',
        name: 'vip',
        component: Vip,
        meta: { title: ['会员管理'] }
      }
    ]
  },


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
